﻿
// HotelManagementMFCView.cpp: CHotelManagementMFCView 类的实现
//

#include "pch.h"
#include "framework.h"
// SHARED_HANDLERS 可以在实现预览、缩略图和搜索筛选器句柄的
// ATL 项目中进行定义，并允许与该项目共享文档代码。
#ifndef SHARED_HANDLERS
#include "HotelManagementMFC.h"
#endif

#include "HotelManagementMFCDoc.h"
#include "HotelManagementMFCView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

#include "CAddRoomDlg.h"
#include "CAddRoomTypeDlg.h"
#include "CAddUserDlg.h"
#include "CDelRoomDlg.h"
#include "CDelRoomTypeDlg.h"
#include "CDelUserDlg.h"
#include "CModifyRoomDlg.h"
#include "CModifyRoomTypeDlg.h"
#include "CModifyUserDlg.h"
#include "CQueryRoomDlg.h"
#include "CQueryRoomTypeDlg.h"
#include "CQueryUserDlg.h"

#include "CInClientDlg.h"
#include "CCheckClientDlg.h"
#include "CModifyClientDlg.h"
#include "CQueryClientDlg.h"
#include "CSysBackupDlg.h"


// 使用全局App
extern CHotelManagementMFCApp theApp;

// CHotelManagementMFCView

IMPLEMENT_DYNCREATE(CHotelManagementMFCView, CView)

BEGIN_MESSAGE_MAP(CHotelManagementMFCView, CView)
	// 标准打印命令
	ON_COMMAND(ID_FILE_PRINT, &CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, &CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, &CView::OnFilePrintPreview)

	ON_COMMAND(ID_ADDROOM, &CHotelManagementMFCView::OnAddroom)
	ON_COMMAND(ID_ADDTYPE, &CHotelManagementMFCView::OnAddtype)
	ON_COMMAND(ID_ADDUSER, &CHotelManagementMFCView::OnAdduser)
	ON_COMMAND(ID_ALLCLIENT, &CHotelManagementMFCView::OnAllClient)
	ON_COMMAND(ID_BACKUPDATA, &CHotelManagementMFCView::OnBackupdata)
	ON_COMMAND(ID_CHECKCLIENT, &CHotelManagementMFCView::OnCheckclient)
	ON_COMMAND(ID_CLIENT, &CHotelManagementMFCView::OnClient)
	ON_COMMAND(ID_DELROOM, &CHotelManagementMFCView::OnDelroom)
	ON_COMMAND(ID_DELTYPE, &CHotelManagementMFCView::OnDeltype)
	ON_COMMAND(ID_DELUSER, &CHotelManagementMFCView::OnDeluser)
	ON_COMMAND(ID_EMPTYROOM, &CHotelManagementMFCView::OnEmptyroom)
	ON_COMMAND(ID_EXIT, &CHotelManagementMFCView::OnExit)
	ON_COMMAND(ID_MODIFYROOM, &CHotelManagementMFCView::OnModifyroom)
	ON_COMMAND(ID_MODIFYTYPE, &CHotelManagementMFCView::OnModifytype)
	ON_COMMAND(ID_MODIFYUSER, &CHotelManagementMFCView::OnModifyuser)
	ON_COMMAND(ID_NOTFULLROOM, &CHotelManagementMFCView::OnNotfullroom)
	ON_COMMAND(ID_QUERTRTYPE, &CHotelManagementMFCView::OnQuertrtype)
	ON_COMMAND(ID_QUERYROOM, &CHotelManagementMFCView::OnQueryroom)
	ON_COMMAND(ID_RESTOREDATA, &CHotelManagementMFCView::OnRestoredata)
	ON_COMMAND(ID_INCLIENT, &CHotelManagementMFCView::OnInclient)
	ON_COMMAND(ID_MODIFYCLIENT, &CHotelManagementMFCView::OnModifyClient)

	ON_UPDATE_COMMAND_UI(ID_ADDROOM, &CHotelManagementMFCView::OnUpdateAddroom)
	ON_UPDATE_COMMAND_UI(ID_ADDTYPE, &CHotelManagementMFCView::OnUpdateAddtype)
	ON_UPDATE_COMMAND_UI(ID_ADDUSER, &CHotelManagementMFCView::OnUpdateAdduser)
	ON_UPDATE_COMMAND_UI(ID_BACKUPDATA, &CHotelManagementMFCView::OnUpdateBackupdata)
	ON_UPDATE_COMMAND_UI(ID_DELROOM, &CHotelManagementMFCView::OnUpdateDelroom)
	ON_UPDATE_COMMAND_UI(ID_DELTYPE, &CHotelManagementMFCView::OnUpdateDeltype)
	ON_UPDATE_COMMAND_UI(ID_DELUSER, &CHotelManagementMFCView::OnUpdateDeluser)
	ON_UPDATE_COMMAND_UI(ID_MODIFYROOM, &CHotelManagementMFCView::OnUpdateModifyroom)
	ON_UPDATE_COMMAND_UI(ID_MODIFYTYPE, &CHotelManagementMFCView::OnUpdateModifytype)
	ON_UPDATE_COMMAND_UI(ID_MODIFYUSER, &CHotelManagementMFCView::OnUpdateModifyuser)
	ON_UPDATE_COMMAND_UI(ID_RESTOREDATA, &CHotelManagementMFCView::OnUpdateRestoredata)
	ON_UPDATE_COMMAND_UI(ID_ALLCLIENT, &CHotelManagementMFCView::OnUpdateAllclient)
	ON_UPDATE_COMMAND_UI(ID_CHECKCLIENT, &CHotelManagementMFCView::OnUpdateCheckclient)
	ON_UPDATE_COMMAND_UI(ID_CLIENT, &CHotelManagementMFCView::OnUpdateClient)
	ON_UPDATE_COMMAND_UI(ID_EMPTYROOM, &CHotelManagementMFCView::OnUpdateEmptyroom)
	ON_UPDATE_COMMAND_UI(ID_EXIT, &CHotelManagementMFCView::OnUpdateExit)
	ON_UPDATE_COMMAND_UI(ID_INCLIENT, &CHotelManagementMFCView::OnUpdateInclient)
	ON_UPDATE_COMMAND_UI(ID_NOTFULLROOM, &CHotelManagementMFCView::OnUpdateNotfullroom)
	ON_UPDATE_COMMAND_UI(ID_QUERTRTYPE, &CHotelManagementMFCView::OnUpdateQuertrtype)
	ON_UPDATE_COMMAND_UI(ID_QUERYROOM, &CHotelManagementMFCView::OnUpdateQueryroom)
END_MESSAGE_MAP()

// CHotelManagementMFCView 构造/析构

CHotelManagementMFCView::CHotelManagementMFCView() noexcept
{
	// TODO: 在此处添加构造代码

}

CHotelManagementMFCView::~CHotelManagementMFCView()
{
}

BOOL CHotelManagementMFCView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: 在此处通过修改
	//  CREATESTRUCT cs 来修改窗口类或样式

	return CView::PreCreateWindow(cs);
}

// CHotelManagementMFCView 绘图

void CHotelManagementMFCView::OnDraw(CDC* pDC)
{
	CHotelManagementMFCDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if (!pDoc)
		return;

	// TODO: 在此处为本机数据添加绘制代码
	CRect r;
	// 获取用户区
	GetClientRect(r);
	// 填充背景
	pDC->FillSolidRect(r, RGB(243, 244, 246));
}


// CHotelManagementMFCView 打印

BOOL CHotelManagementMFCView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// 默认准备
	return DoPreparePrinting(pInfo);
}

void CHotelManagementMFCView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: 添加额外的打印前进行的初始化过程
}

void CHotelManagementMFCView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: 添加打印后进行的清理过程
}


// CHotelManagementMFCView 诊断

#ifdef _DEBUG
void CHotelManagementMFCView::AssertValid() const
{
	CView::AssertValid();
}

void CHotelManagementMFCView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CHotelManagementMFCDoc* CHotelManagementMFCView::GetDocument() const // 非调试版本是内联的
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CHotelManagementMFCDoc)));
	return (CHotelManagementMFCDoc*)m_pDocument;
}
#endif //_DEBUG


// CHotelManagementMFCView 消息处理程序

/////// COMMAND ///////

//// ADD ////

void CHotelManagementMFCView::OnAddroom()
{
	CAddRoomDlg addRoom;
	addRoom.DoModal();
}


void CHotelManagementMFCView::OnAddtype()
{
	CAddRoomTypeDlg addRoomType;
	addRoomType.DoModal();
}


void CHotelManagementMFCView::OnAdduser()
{
	CAddUserDlg addUser;
	addUser.DoModal();
}


void CHotelManagementMFCView::OnInclient()
{
	CInClientDlg inClient;
	inClient.DoModal();
}


//// DELETE ////

void CHotelManagementMFCView::OnDelroom()
{
	CDelRoomDlg delRoom;
	delRoom.DoModal();
}


void CHotelManagementMFCView::OnDeltype()
{
	CDelRoomTypeDlg delRoomType;
	delRoomType.DoModal();
}


void CHotelManagementMFCView::OnDeluser()
{
	CDelUserDlg delUser;
	delUser.DoModal();
}


void CHotelManagementMFCView::OnCheckclient()
{
	CCheckClientDlg checkClient;
	checkClient.DoModal();
}


//// UPDATE ////

void CHotelManagementMFCView::OnModifyroom()
{
	CModifyRoomDlg modifyRoom;
	modifyRoom.DoModal();
}


void CHotelManagementMFCView::OnModifytype()
{
	CModifyRoomTypeDlg modifyRoomType;
	modifyRoomType.DoModal();
}


void CHotelManagementMFCView::OnModifyuser()
{
	CModifyUserDlg modifyUser;
	modifyUser.DoModal();
}


void CHotelManagementMFCView::OnModifyClient()
{
	CModifyClientDlg modifyClient;
	modifyClient.DoModal();
}


//// SELECT ////

void CHotelManagementMFCView::OnQueryroom()
{
	theApp.roomFlag = theApp.ROOM_ALL;
	CQueryRoomDlg queryRoom;
	queryRoom.DoModal();
}


void CHotelManagementMFCView::OnEmptyroom()
{
	// TODO: 在此添加命令处理程序代码
	theApp.roomFlag = theApp.ROOM_EMPTY;
	CQueryRoomDlg queryRoom;
	queryRoom.DoModal();
}


void CHotelManagementMFCView::OnNotfullroom()
{
	// TODO: 在此添加命令处理程序代码
	theApp.roomFlag = theApp.ROOM_NOTFULL;
	CQueryRoomDlg queryRoom;
	queryRoom.DoModal();
}

void CHotelManagementMFCView::OnQuertrtype()
{
	CQueryRoomTypeDlg queryRoomType;
	queryRoomType.DoModal();
}


// TODO: Select User


void CHotelManagementMFCView::OnAllClient()
{
	theApp.userFlag = theApp.USER_ALL;
	CQueryClientDlg queryClient;
	queryClient.DoModal();
}


void CHotelManagementMFCView::OnClient()
{
	theApp.userFlag = theApp.USER_SPECIIFIC;
	CQueryClientDlg queryClient;
	queryClient.DoModal();
}


//// BASE SETTING ////

void CHotelManagementMFCView::OnBackupdata()
{
	CSysBackupDlg dlg;
	dlg.DoModal();
}


void CHotelManagementMFCView::OnRestoredata()
{
	// TODO: 在此添加命令处理程序代码
}


void CHotelManagementMFCView::OnExit()
{
	// TODO: 在此添加命令处理程序代码
}


/////// UPDATE UI ///////

/// USER LIMIT ///


void CHotelManagementMFCView::OnUpdateAddroom(CCmdUI* pCmdUI)
{
	// TODO: 在此添加命令更新用户界面处理程序代码
	pCmdUI->Enable(theApp.nFlag);
}


void CHotelManagementMFCView::OnUpdateAddtype(CCmdUI* pCmdUI)
{
	// TODO: 在此添加命令更新用户界面处理程序代码
	pCmdUI->Enable(theApp.nFlag);
}


void CHotelManagementMFCView::OnUpdateAdduser(CCmdUI* pCmdUI)
{
	// TODO: 在此添加命令更新用户界面处理程序代码
	pCmdUI->Enable(theApp.nFlag);
}


void CHotelManagementMFCView::OnUpdateBackupdata(CCmdUI* pCmdUI)
{
	// TODO: 在此添加命令更新用户界面处理程序代码
	pCmdUI->Enable(theApp.nFlag);
}


void CHotelManagementMFCView::OnUpdateDelroom(CCmdUI* pCmdUI)
{
	// TODO: 在此添加命令更新用户界面处理程序代码
	pCmdUI->Enable(theApp.nFlag);
}


void CHotelManagementMFCView::OnUpdateDeltype(CCmdUI* pCmdUI)
{
	// TODO: 在此添加命令更新用户界面处理程序代码
	pCmdUI->Enable(theApp.nFlag);
}


void CHotelManagementMFCView::OnUpdateDeluser(CCmdUI* pCmdUI)
{
	// TODO: 在此添加命令更新用户界面处理程序代码
	pCmdUI->Enable(theApp.nFlag);
}


void CHotelManagementMFCView::OnUpdateModifyroom(CCmdUI* pCmdUI)
{
	// TODO: 在此添加命令更新用户界面处理程序代码
	pCmdUI->Enable(theApp.nFlag);
}


void CHotelManagementMFCView::OnUpdateModifytype(CCmdUI* pCmdUI)
{
	// TODO: 在此添加命令更新用户界面处理程序代码
	pCmdUI->Enable(theApp.nFlag);
}


void CHotelManagementMFCView::OnUpdateModifyuser(CCmdUI* pCmdUI)
{
	// TODO: 在此添加命令更新用户界面处理程序代码
	pCmdUI->Enable(theApp.nFlag);
}


void CHotelManagementMFCView::OnUpdateRestoredata(CCmdUI* pCmdUI)
{
	// TODO: 在此添加命令更新用户界面处理程序代码
	pCmdUI->Enable(theApp.nFlag);
}


/// USER PUBLIC ///


void CHotelManagementMFCView::OnUpdateAllclient(CCmdUI* pCmdUI)
{
	// TODO: 在此添加命令更新用户界面处理程序代码
}

void CHotelManagementMFCView::OnUpdateCheckclient(CCmdUI* pCmdUI)
{
	// TODO: 在此添加命令更新用户界面处理程序代码
}


void CHotelManagementMFCView::OnUpdateClient(CCmdUI* pCmdUI)
{
	// TODO: 在此添加命令更新用户界面处理程序代码
}


void CHotelManagementMFCView::OnUpdateEmptyroom(CCmdUI* pCmdUI)
{
	// TODO: 在此添加命令更新用户界面处理程序代码
}


void CHotelManagementMFCView::OnUpdateExit(CCmdUI* pCmdUI)
{
	// TODO: 在此添加命令更新用户界面处理程序代码
}


void CHotelManagementMFCView::OnUpdateInclient(CCmdUI* pCmdUI)
{
	// TODO: 在此添加命令更新用户界面处理程序代码
}


void CHotelManagementMFCView::OnUpdateNotfullroom(CCmdUI* pCmdUI)
{
	// TODO: 在此添加命令更新用户界面处理程序代码
}


void CHotelManagementMFCView::OnUpdateQuertrtype(CCmdUI* pCmdUI)
{
	// TODO: 在此添加命令更新用户界面处理程序代码
}


void CHotelManagementMFCView::OnUpdateQueryroom(CCmdUI* pCmdUI)
{
	// TODO: 在此添加命令更新用户界面处理程序代码
}
